function lop_get(url, data, callback) {
  lop_ajax(url, "GET", data, callback);
}
function lop_post(url, data, callback) {
  lop_ajax(url, "POST", data, callback);
}
function lop_ajax(url, type, data, callback, cache, processData, contentType) {

  let dataJason = {
    url: url,
    type: type,
    data: data,
    dataType: 'json',
    success: callback
  };

  if ( cache === false ){
    dataJason.cache = cache;
  }
  if ( processData === false ){
    dataJason.processData = processData;
  }
  if ( contentType === false ){
    dataJason.contentType = contentType;
  }

  $.ajax(dataJason);
}

function lop_show_ok(text){
  lop_all_show("lop-msg-success", "icon-lop-success", text);
}

function lop_show_error(text){
  lop_all_show("lop-msg-error", "icon-lop-error", text);
}

function lop_show_warn(text){
  lop_all_show("lop-msg-warn", "icon-lop-warn", text);
}

function lop_all_show(cls1, cls2, text){

  let $msgBox = '<div class="lop-msg ' + cls1 + '">\n' +
    '    <i class="iconfont ' + cls2 + '"></i>\n' +
    '    <p class="lop-msg-text">' + text + '</p>\n' +
    '  </div>';

  $('.lop-msg-box').prepend($msgBox);
  $('.lop-msg-box').css('z-index', '9999');

  $('.lop-msg-box').children(':first').slideDown(400);

  setTimeout(function(){
    $('.lop-msg-box').children(':last').fadeOut(400);

    setTimeout(function() {
      $('.lop-msg-box').children(':last').remove();

      if ( $('.lop-msg-box').children('.lop-msg').length <= 0 )
        $('.lop-msg-box').css('z-index', '-1');
      }, 500);
  }, 3000);

}

$(function(){
  $('body').append("<div class=\"lop-msg-box\"></div>");
});